Skip to content

[ERP-2110 & ERP-2111] Replaced all remaining Alert and Text Components #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

NikuPAN
Copy link
Contributor

@NikuPAN NikuPAN commented Jul 23, 2024

Replaced all remaining Alert and Text Components to our helper components

@NikuPAN NikuPAN requested a review from ScriptSmith July 23, 2024 03:41
return (
<TextWithLink
textBeforeLink={"You may need to enable the "}
link={{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The color is different than in the main branch and doesn't look quite right because the color is not unset, and "teal.500" is the default now. Is there a reason for that, or can we use "blue.500" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can use blue.500

import InstructionHeading from "./components/InstructionHeading";
import InstructionText from "./components/InstructionText";
import { OperatingSystemTabs } from "./components/OperatingSystemTabs";

function LyraInstructions({ username }) {
const enableSSHText = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than making this a function, can we update AlertHelper to support passing React elements as the value for alertMessage?

You can use React's isValidElement in the condition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component itself already supporting passing message prop as a function or simple string, we can just add a children prop to support TextWithLink component being wrapped by AlertHelper in this case.

… support for wrapping child elements for AlertHelper.
@NikuPAN NikuPAN requested a review from ScriptSmith July 23, 2024 22:47
@@ -46,9 +32,21 @@ function LyraInstructions({ username }) {
<Box>
<AlertHelper
alertType={"info"}
alertMsg={enableSSHText}
// alertMsg={enableSSHText}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -5,6 +5,7 @@ export default function AlertHelper({
alertType = "info",
alertMsg = null,
onClose = {},
children = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really a fan of having two different props to set the same thing, as you have to know internal details of the component in order to know which prop has precedent. Is there a reason to not use one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we can just make one props to support multiple types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@NikuPAN NikuPAN requested a review from ScriptSmith July 24, 2024 04:18
@NikuPAN NikuPAN merged commit 7e8ea6e into main Jul 25, 2024
1 check passed
@NikuPAN NikuPAN deleted the ERP-2110-2111-Alert-TextLink-Components-Apply branch July 25, 2024 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants